﻿@namespace LaserMark.Components
@inject IDBManager DbManager

<div class="machine-settings">
    <Table TItem="MachineSetting" IsBordered="true" IsExcel="true" OnQueryAsync="@OnQueryAsync" OnSaveAsync="@OnSaveAsync" IsFixedHeader="true" Height="485" IsMultipleSelect="false">
        <TableColumns Context="col">
            <TableColumn @bind-Field="col.ProjectName" Text="项目" IsReadonlyWhenEdit="true"></TableColumn>
            <TableColumn @bind-Field="col.X" Text="X" Step="0.00001"></TableColumn>
            <TableColumn @bind-Field="col.Y" Text="Y" Step="0.01">
                <EditTemplate>
                    @if (context.Key == "MarkVel")
                    {
                        <BootstrapInputNumber @bind-Value="context.Y" IsDisabled="true"></BootstrapInputNumber>
                    }
                    else if (context.Key == "MarkAcc")
                    {
                        <BootstrapInputNumber @bind-Value="context.Y" IsDisabled="true"></BootstrapInputNumber>
                    }
                    else if (context.Key == "MarkDcc")
                    {
                        <BootstrapInputNumber @bind-Value="context.Y" IsDisabled="true"></BootstrapInputNumber>
                    }
                    else
                    {
                        <BootstrapInputNumber @bind-Value="context.Y" OnValueChanged=" v => OnValueChanged(context,v)"></BootstrapInputNumber>
                    }
                </EditTemplate>
            </TableColumn>
            <TableColumn @bind-Field="col.Z" Text="Z" Step="0.01">
                <EditTemplate>
                    @if (context.Key == "MarkVel")
                    {
                        <BootstrapInputNumber @bind-Value="context.Z" IsDisabled="true"></BootstrapInputNumber>
                    }
                    else if (context.Key == "MarkAcc")
                    {
                        <BootstrapInputNumber @bind-Value="context.Z" IsDisabled="true"></BootstrapInputNumber>
                    }
                    else if (context.Key == "MarkDcc")
                    {
                        <BootstrapInputNumber @bind-Value="context.Z" IsDisabled="true"></BootstrapInputNumber>
                    }
                    else
                    {
                        <BootstrapInputNumber @bind-Value="context.Z" OnValueChanged=" v => OnValueChanged(context,v)"></BootstrapInputNumber>
                    }
                </EditTemplate>
            </TableColumn>
            <TableColumn @bind-Field="col.G" Text="G" Step="0.01">
                <EditTemplate>
                    @if (context.Key == "MarkVel")
                    {
                        <BootstrapInputNumber @bind-Value="context.G" IsDisabled="true"></BootstrapInputNumber>
                    }
                    else if (context.Key == "MarkAcc")
                    {
                        <BootstrapInputNumber @bind-Value="context.G" IsDisabled="true"></BootstrapInputNumber>
                    }
                    else if (context.Key == "MarkDcc")
                    {
                        <BootstrapInputNumber @bind-Value="context.G" IsDisabled="true"></BootstrapInputNumber>
                    }
                    else
                    {
                        <BootstrapInputNumber @bind-Value="context.G" OnValueChanged=" v => OnValueChanged(context,v)"></BootstrapInputNumber>
                    }
                </EditTemplate>
            </TableColumn>
        </TableColumns>
    </Table>
</div>

<DialogFooter OnSave="@OnSave"></DialogFooter>
